function EditorDoc(doc) {
    this.editorPages = [];
    this.pdDoc = doc; //PDDoc object
    
   
    this.Init = function () {
        var n = this.pdDoc.GetCountPages();
        for (var i = 0; i < n; i++) {
            this.editorPages[i] = null;
            this.NewEditorPage(i);
        }
    };
    this.NewEditorPage = function (index) {
        if (index < 0 || index >= this.GetEditorPageCount())
            return null;

        var edPage = null;
        if (index < this.GetEditorPageCount())
            edPage = this.GetEditorPage(index);
        if (null == edPage) {
            edPage = new EditorPage();
            edPage.editorDoc = this;
            edPage.SetIndex(index);
            edPage.SetPDPage(this.pdDoc.GetPageByIndex(index));
            this.editorPages[index] = edPage;
        }
        return edPage;
    };
    this.GetPDDoc = function () { return this.pdDoc; };
    this.SetPDDoc = function (doc) { this.pdDoc = doc; };

    this.GetEditorPageCount = function () {
        return this.editorPages.length;
    };

    this.GetEditorPage = function (index) {
        if (index < 0 || index >= this.GetEditorPageCount())
            return null;
        return this.editorPages[index];
    };
    
  
}